package opensocial4gwt;

import com.google.gwt.core.client.JavaScriptObject;

public final class DataRequest extends BaseJsObject {
	public static class Request extends JavaScriptObject {
		protected Request() {}
	}
	
	protected DataRequest() {}
	
	public native void add(Request request, String key) /*-{
		this.add(request, key);
	}-*/;

	public native void send(Callback<DataResponse> callback) /*-{
		this.send(function(data) {
			@opensocial4gwt.DataRequest::fireCallback(Lopensocial4gwt/Callback;Lopensocial4gwt/DataResponse;)(callback, data);
		});
	}-*/;

	private static void fireCallback(Callback<DataResponse> callback, DataResponse result) {
		callback.onSuccess(result);
	}
}
